package com.teacher.ellio;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;

/**
 * 启动界面Activity
 * 展示应用品牌，提供2秒缓冲时间用于初始化
 */
public class SplashActivity extends Activity {
    
    private static final int SPLASH_DURATION = 2000; // 2秒启动时间
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        
        // 延迟跳转到主游戏界面
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                startMainActivity();
            }
        }, SPLASH_DURATION);
    }
    
    /**
     * 跳转到主游戏Activity
     */
    private void startMainActivity() {
        Intent intent = new Intent(SplashActivity.this, GameMainActivity.class);
        startActivity(intent);
        finish(); // 结束启动界面，防止用户返回
    }
    
    @Override
    public void onBackPressed() {
        // 启动界面期间禁用返回键
        // 防止用户意外退出应用
    }
}